<table class="eui-datagrid" id="grid" style="height:100%"
	data-options="idField:'id',
		singleSelect:false,
		collapsible:true,
		striped:true,
		nowrap:true,
		fitColumns:true,scrollbarSize :0,
		url:'${path}/eframe/rights/etbuser/user!list.action',
		method:'post',
		onLoadError:showErrorMsg,
		autoRowHeight:false,
		onClickRow: onlySelectDatagridRow,
		pagination:true,
		pageList:[1,5,10,15,20,30,50,100],
		pageSize:10,
		toolbar:'#tools'">
	<thead>
		<tr width="100%">
			<th data-options="field:'id',checkbox:true"></th>
			<th data-options="field:'loginname',halign:'center',align:'left',width:25">登录名称</th>
			<th data-options="field:'username',halign:'center',align:'left',width:25">姓名</th>
			<th data-options="field:'createTime',halign:'center',align:'center',width:25">创建时间</th>
		</tr>
	</thead>
</table>
<div id="tools" style="padding:5px;height:auto">
	<div style="margin-bottom:5px">
		<a href="javascript:void(0)" class="eui-linkbutton" iconCls="icon-add" plain="true" id="addbtn">添加</a>
		<a href="javascript:void(0)" class="eui-linkbutton" iconCls="icon-edit" plain="true" id="updatebtn">修改</a>
		<a href="javascript:void(0)" class="eui-linkbutton" iconCls="icon-remove" plain="true" id="deletebtn">删除</a>
		<a href="javascript:void(0)" class="eui-linkbutton" iconCls="icon-ok" plain="true" id="authbtn">配置权限</a>
		<span>|</span>
		<a href="javascript:void(0)" class="eui-linkbutton" iconCls="icon-lock" plain="true" id="resetbtn">重置密码</a>
	</div>
	<div>
		<table class="condition-table">
			<tr>
				<th>登录名：</th>
				<td><input class="eui-textbox" style="width:120px" name="criteria.expr['loginname_like']"></td>
				<th>姓名：</th>
				<td><input class="eui-textbox" style="width:120px" name="criteria.expr['username_like']"></td>
				<td><a href="javascript:void(0)" class="eui-linkbutton" iconCls="icon-search" plain="true" id="searchbtn">查询</a></td>
			</tr>
		</table>
	</div>
</div>
<script>
	function load() {
		$("#grid").datagrid("reloadWithCriteria");
	}
	
	$("#searchbtn").click(function(){
		$("#grid").datagrid('reloadWithCriteria');
	});
	
	$("#addbtn").click(function(){
		dialog.open({
			width:600,
			height:300,
			url:'${path}/eframe/rights/etbuser/add.ftl',
			success:load
		});
	});
	
	$("#updatebtn").click(function(){
		var rows = $("#grid").datagrid("getSelections");
		if(rows.length > 0) {
			dialog.open({
				width:600,
				height:300,
				url:'${path}/eframe/rights/etbuser/user!updateView.action?id='+rows[0].id,
				success:load
			});
		}
	});
	
	$("#deletebtn").click(function(){
		$("#grid").datagrid("deleteSelected",{
			url: "${path}/eframe/rights/etbuser/user!delete.action",
			success:load
		});
	});
	
	$("#resetbtn").click(function(){
		$("#grid").datagrid("executeSelected",{
			url: "${path}/eframe/rights/etbuser/user!resetPassword.action",
			success:load,
			action: "重置密码"
		});
	});
	
	$("#authbtn").click(function(){
		var rows = $("#grid").datagrid("getSelections");
		if(rows.length != 1) {
			$.messager.alert('提示','请选择一条数据','warning');
			return;
		}
		dialog.open({
			width:800,
			height:500,
			url:'${path}/eframe/rights/etbuser/auth.ftl?userid='+rows[0].id,
			buttons:'none'
		});
	});
</script>